import UMe from "../frameSccript/system/OverallSystem ";
import iConsole from "../ipha_tool/iphaNamespace/IConsleNamespace";

export enum GameState {
    start,
    play,
    wait,
    over,
}

export default class GameStateClass {

    private readonly stateName: string[] = ["开始", "运行", "等待", "结束"];

    private m_State: GameState = GameState.start;
    get state() { return this.m_State; }

    check(...state: GameState[]) {
        let isState = state.includes(this.m_State);
        // console.group("GameState check");
        // console.log("isState :", isState);
        // console.log("state :", state);
        // console.log("m_State :", this.m_State);
        // console.groupEnd();
        return isState;
    }

    shift(state: GameState) {
        this.m_State = state;
        UMe.emit("Game-state" + state);
        iConsole.log_red_bg_yellow("游戏状态---", this.stateName[this.m_State]);
    }
}